package cmk.lee.easy;

import java.util.HashSet;
import java.util.Set;

public class Leecode_3 {
	public static int lengthOfLongestSubstring(String s) {
		int max = 0;
		int start = 0;
		int end = 0;
		Set<Character> set = new HashSet<Character>();
		while(end<s.length()) {
			if(set.contains(s.charAt(end))) {
				set.remove(s.charAt(start++));
			}else{
				set.add(s.charAt(end++));
				max = Math.max(max, end-start);
			}
		}
		return max;

	}

	public static void main(String[] args) {
		System.out.println("测试git 分支合并");
		System.out.println(lengthOfLongestSubstring("pwwkew"));
	}
}
